package com.ease.common.vo;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author nathanleewei
 * 
 */
public class ProjectBundle {

	private String name;

	private String bundleVersion;

	private BundleManifest bundleManifest;

	private List<ProjectBundle> requireBundles;

	public ProjectBundle() {

	}

	public ProjectBundle(String name) {
		this.setName(name);
	}

	public ProjectBundle addRequireBundle(ProjectBundle projectBundle) {
		if (null == requireBundles) {
			requireBundles = new ArrayList<ProjectBundle>();
			requireBundles.add(projectBundle);
		} else {
			boolean exist = false;
			for (ProjectBundle requireBundle : requireBundles) {
				if (projectBundle.getName().equals(requireBundle.getName())) {
					exist = true;
				}
			}
			if (false == exist) {
				requireBundles.add(projectBundle);
			}
		}

		return this;
	}

	/**
	 * @return the bundleManifest
	 */
	public BundleManifest getBundleManifest() {
		return bundleManifest;
	}

	/**
	 * @param bundleManifest
	 *            the bundleManifest to set
	 */
	public void setBundleManifest(BundleManifest bundleManifest) {
		this.bundleManifest = bundleManifest;
	}

	/**
	 * @return the requireBundles
	 */
	public List<ProjectBundle> getRequireBundles() {
		return requireBundles;
	}

	/**
	 * @param requireBundles
	 *            the requireBundles to set
	 */
	public void setRequireBundles(List<ProjectBundle> requireBundles) {
		this.requireBundles = requireBundles;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the bundleVersion
	 */
	public String getBundleVersion() {
		return bundleVersion;
	}

	/**
	 * @param bundleVersion
	 *            the bundleVersion to set
	 */
	public void setBundleVersion(String bundleVersion) {
		this.bundleVersion = bundleVersion;
	}

}
